<template>
	<view class="content">
		<view class="data-area">
			<view class="input-title">个人中心数据</view>
<!--			<view class="input-area">
				<view class="input-area-label">头像：</view>
				<input class="uni-input" v-model="mineData.avatar" placeholder="请输入" />
			</view>-->
			<view class="input-area">
				<view class="input-area-label">昵称：</view>
				<input class="uni-input" v-model="mineData.nickName" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">手机号：</view>
				<input class="uni-input" v-model="mineData.phone" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">ID：</view>
				<input class="uni-input" v-model="mineData.id" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">会员天数：</view>
				<input class="uni-input" v-model="mineData.vipDays" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">剩余点数：</view>
				<input class="uni-input" v-model="mineData.lostDots" placeholder="请输入" />
			</view>
		</view>
		
		<view class="data-area">
			<view class="input-title">推广中心数据</view>
			<view class="input-area">
				<view class="input-area-label">账户余额：</view>
				<input class="uni-input" v-model="promotionCenterData.accountBalance" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">已提现：</view>
				<input class="uni-input" v-model="promotionCenterData.withdrawn" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">提现中：</view>
				<input class="uni-input" v-model="promotionCenterData.withdrawing" placeholder="请输入" />
			</view>
		</view>
		
		<view class="data-area">
			<view class="input-title">效果数据</view>
			<view class="input-title">今日收益</view>
			<view class="input-area">
				<view class="input-area-label">注册用户：</view>
				<input class="uni-input" v-model="effectData.todayIncome.registerUser" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">付款数：</view>
				<input class="uni-input" v-model="dataPanelData.todayPay" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">佣金收入：</view>
				<input class="uni-input" v-model="dataPanelData.todayPayMoney" placeholder="请输入" />
			</view>
			
			<view class="input-title">昨日收益</view>
			<view class="input-area">
				<view class="input-area-label">注册用户：</view>
				<input class="uni-input" v-model="effectData.yesterdayIncome.registerUser" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">付款数：</view>
				<input class="uni-input" v-model="dataPanelData.yesterdayPay" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">佣金收入：</view>
				<input class="uni-input" v-model="dataPanelData.yesterdayPayMoney" placeholder="请输入" />
			</view>
			
			<view class="input-title">近7日</view>
			<view class="input-area">
				<view class="input-area-label">注册用户：</view>
				<input class="uni-input" v-model="effectData.recentWeek.registerUser" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">付款数：</view>
				<input class="uni-input" v-model="effectData.recentWeek.payNum" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">佣金收入：</view>
				<input class="uni-input" v-model="effectData.recentWeek.commissionIncome" placeholder="请输入" />
			</view>
			
			
			<view class="input-title">近30日</view>
			<view class="input-area">
				<view class="input-area-label">注册用户：</view>
				<input class="uni-input" v-model="effectData.recentMonth.registerUser" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">付款数：</view>
				<input class="uni-input" v-model="effectData.recentMonth.payNum" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">佣金收入：</view>
				<input class="uni-input" v-model="effectData.recentMonth.commissionIncome" placeholder="请输入" />
			</view>
		</view>
		
		
		<view class="data-area">
			<view class="input-title">数据看板</view>
			<view class="input-area">
				<view class="input-area-label">用户总数：</view>
				<input class="uni-input" v-model="dataPanelData.userTotalNum" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">会员总数：</view>
				<input class="uni-input" v-model="dataPanelData.vipTotalNum" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">付费总数：</view>
				<input class="uni-input" v-model="dataPanelData.payTotalNum" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">今日新增：</view>
				<input class="uni-input" v-model="dataPanelData.todayPay" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">昨日新增：</view>
				<input class="uni-input" v-model="dataPanelData.yesterdayPay" placeholder="请输入" />
			</view><view class="input-area">
				<view class="input-area-label">最近一小时注册：</view>
				<input class="uni-input" v-model="dataPanelData.lastHourRegister" placeholder="请输入" />
			</view>
			<view class="input-area">
				<view class="input-area-label">今日付款--(笔)：</view>
				<input class="uni-input" v-model="dataPanelData.todayPay" placeholder="请输入" />
			</view>
        <view class="input-area">
            <view class="input-area-label">今日付款--(钱数)：</view>
            <input class="uni-input" v-model="dataPanelData.todayPayMoney" placeholder="请输入" />
        </view>
			<view class="input-area">
				<view class="input-area-label">昨日付款--(笔)：</view>
				<input class="uni-input" v-model="dataPanelData.yesterdayPay" placeholder="请输入" />
			</view>
        <view class="input-area">
            <view class="input-area-label">昨日付款--(钱数)：</view>
            <input class="uni-input" v-model="dataPanelData.yesterdayPayMoney" placeholder="请输入" />
        </view>
			<view class="input-area">
				<view class="input-area-label">累计付款（无需填写 账户余额+已提现=累计付款）：</view>
				<input class="uni-input" disabled v-model="dataPanelData.cumPay" placeholder="请输入" />
			</view>
		
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//个人中心数据
				mineData:{
					//头像
					avatar:'',
					nickName:'',
					phone:'',
					id:'',
					//会员天数
					vipDays:'',
					//剩余点数
					lostDots:'',
				},
				//推广中心数据
				promotionCenterData:{
					accountBalance:'',
					//已提现
					withdrawn:'',
					//提现中
					withdrawing:'',
				},
				//效果数据
				effectData:{
					//今日收益
					todayIncome:{
						//注册用户
						registerUser:'',
						//付款数
						payNum:'',
						//佣金收入
						commissionIncome:'',
					},
					//昨日收益
					yesterdayIncome:{
						registerUser:'',
						payNum:'',
						commissionIncome:'',
					},
					//近7日
					recentWeek:{
						registerUser:'',
						payNum:'',
						commissionIncome:'',
					},
					//近30日
					recentMonth:{
						registerUser:'',
						payNum:'',
						commissionIncome:'',
					}
				},
				//数据看板数据
				dataPanelData:{
					//用户总数
					userTotalNum:'',
					//会员总数
					vipTotalNum:'',
					//付费总数
					payTotalNum:'',
					//今日新增
					todayAdd:'',
					//昨日新增
					yesterdayAdd:'',
					//最近一小时注册
					lastHourRegister:'',
					//今日付款
					todayPay:'',
            todayPayMoney:'',
					//昨日付款
					yesterdayPay:'',
            yesterdayPayMoney:'',
					//累计付款
					cumPay:''
				},
			}
		},
		onLoad() {

		}, 
		onHide() {
        if (this.promotionCenterData.withdrawn && this.promotionCenterData.accountBalance) {
            const withdrawn = parseFloat(this.promotionCenterData.withdrawn);
            const balance = parseFloat(this.promotionCenterData.accountBalance);
            this.dataPanelData.cumPay = (isNaN(withdrawn) ? 0 : withdrawn) + (isNaN(balance) ? 0 : balance);
            this.dataPanelData.cumPay = Number(this.dataPanelData.cumPay.toFixed(2));
            console.log(this.dataPanelData.cumPay)
        }
			uni.setStorageSync('mineData', this.mineData);
			uni.setStorageSync('promotionCenterData', this.promotionCenterData);
			uni.setStorageSync('effectData', this.effectData);
			uni.setStorageSync('dataPanelData', this.dataPanelData);
			console.log('首页数据设置Hide');
		},
		onShow() {
        this.mineData.avatar =	uni.getStorageSync('mineData').avatar;
        //再次进入页面清空数据
			/*uni.removeStorageSync('mineData');
			uni.removeStorageSync('promotionCenterData');
			uni.removeStorageSync('effectData');
			uni.removeStorageSync('dataPanelData');*/
			console.log('首页数据设置Show');
		},
		methods: {
			clearIcon(){
				
			}
		}
	}
</script>

<style lang="scss" scoped>
.data-area {
	margin-top: 10rpx;
	padding: 10rpx;
	border: navy solid 1px;
	.input-title {
		font-size: 18px;
		color: darkred;
	}
	.input-area {
		margin-top: 20rpx;
		margin-left: 40rpx;
		
		.uni-input {
			border:black solid 1px;
		}
	}
}

</style>